<template>
  <div class="box">
    <div class="card">
      <img class="close" src="./img/u1381.png" @click.stop="close">
      <div class="title">{{ title }}</div>
      <div> {{ nodeName }} </div>
      <div> {{ content }} </div>
      <div class="btn">
        <div class="btn-item red" @click.stop="close">取消</div>
        <div class="btn-item" @click.stop="call">确定</div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'ConfirmBox',
  props: {
    title: {
      type: String,
      default: '提示'
    },
    nodeName: {
      type: String,
      default: ''
    },
    content: {
      type: String,
      default: ''
    }
  },
  destroyed() {
    // console.log('destroy')
  },
  methods: {
    close() {
      this.$emit('close')
    },
    call() {
      this.$emit('ok')
    }
  }
}
</script>

<style lang="scss" scoped>
.box {
  position: fixed;
  z-index: 2000;
  width: 100vw;
  height: 100vh;
  color: #fff;
  background: rgba($color: #000000, $alpha: 0.4);
  inset: 0;
  .card {
    position: absolute;
    top: 50%;
    left: 50%;
    padding: 10px 20px;
    transform: translate(-50%, -50%);
    border: 1px solid #00c1fe;
    border-radius: 4px;
    background: rgba($color: #1d4656, $alpha: 0.9);
    .close {
      position: absolute;
      top: 10px;
      right: 5px;
      width: 14px;
      height: 14px;
      cursor: pointer;
    }
    .title {
      margin: 0 10px 10px 0;
      color: #fff;
      font-size: 18px;
    }
    .btn {
      display: flex;
      flex: 1;
      justify-content: flex-end;
      min-width: 100px;
      margin-top: 10px;
      gap: 20px;
      .btn-item {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 32px;
        padding: 0 15px;
        cursor: pointer;
        color: #fff;
        border: 1px solid #00c2ff;
        border-radius: 4px;
        background: #1d435f;
        box-shadow: 0px 0px 10px 0px rgba(0, 194, 255, 1) inset;
        gap: 3px;
        &:hover {
          opacity: .8;
        }
      }
      .red {
        border: 1px solid #fa5151;
        background: #400b0b;
        box-shadow: 0px 0px 10px 0px rgba(250, 81, 81, 1) inset;
      }
    }
  }
}
</style>
